package com.kuang.array;

import java.lang.reflect.Array;

/**
 * @author wuJiaWei
 * @version 1.0
 * @date 2024/8/9
 * @time 17:05:00
 */
public class Demo03 {
    public static void main(String[] args) {
        int[] arrays = {1,2,3};
        // 遍历数组
        for (int i = 0; i < arrays.length; i++) {
            System.out.println(arrays[i]);
        }
        System.out.println("==========");
        for (int array : arrays) {
            System.out.println(array);
        }
        System.out.println("==========");
        //查找最大元素
        int max = arrays[0];
        for (int array : arrays) {
            if (array > max){
                max = array;
            }
        }
        System.out.println(arrays.length);
        System.out.println("最大值是：" + max);
    }
}
